<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://displaytag.sf.net" prefix="display"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<s:set name="fname" value="user.firstName" />
<s:set name="lname" value="user.lastName" />
<s:set name="street" value="user.street" />
<s:set name="city" value="user.city" />
<s:set name="state" value="user.state.categoryName" />
<s:set name="country" value="user.country.categoryName" />
<s:set name="vatid" value="user.vatidnr1" />

<link href="../../css/style.css" rel="stylesheet" type="text/css" />
<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td>
			<s:actionerror cssClass="error-text" theme="simple"/>
			<s:actionmessage cssClass="common-text" theme="simple"/>
		</td>
	</tr>
	<tr>
		<td>
			<div class="blue-text16" style="margin: 0px 0px 0px 0px">
				<s:text name="Send invoice" />
			</div>
			<div style="margin: 0px 0px 0px 17px">
				<!--middle ad banner start -->
				<!--middle ad banner end -->
				<!--featured items start -->
				<!--featured items start -->
				<div class="header-separator-bg" style="margin: 10px 5px 17px 0px"></div>
				<div style="margin: 0px 0px 22px 0px"></div></div>
		</td>
	</tr>
	<tr>
		<td colspan="2" align="center"><b>Invoice date:<s:date name="invoiceDate" format="dd MMMM, yyyy" /></b></td>
	</tr>
	<tr>
		<td colspan="2" align="left"><b>Account name:<s:property value="user.userId" /></b></td>
	</tr>
	<tr>
		<td colspan="2">&nbsp;</td>
	</tr>
	<tr>
		<td colspan="2">
			<table width="100%" cellpadding="0" cellspacing="0" align="center">
			<s:iterator value="transactionsMap" status="row">
				<tr>
					<td width="30%">&nbsp;</td>
					<td width="35%"><b>Invoice by</b></td>
					<td width="35%"><b>Invoice to</b></td>
				</tr>
				<tr>
					<td>Name:</td>
					<td><s:property value="fname" />&nbsp;<s:property value="lname" /></td>
					<td><s:property value="value.user.firstName" />&nbsp;<s:property value="value.user.lastName" /></td>
				</tr>
				<tr>
					<td>Address:</td>
					<td><s:property value="street" /></td>
					<td><s:property value="value.user.street" /></td>
				</tr>
				<tr>
					<td>City:</td>
					<td><s:property value="city" /></td>
					<td><s:property value="value.user.city" /></td>
				</tr>
				<tr>
					<td>State:</td>
					<td><s:property value="state" /></td>
					<td><s:property value="value.user.state.categoryName" /></td>
				</tr>
				<tr>
					<td>Country:</td>
					<td><s:property value="country" /></td>
					<td><s:property value="value.user.country.categoryName" /></td>
				</tr>
				<tr>
					<td>VAT-ID Nr:</td>
					<td><s:property value="vatid" /></td>
					<td><s:property value="value.user.vatidnr1" /></td>
				</tr>
				<tr>
					<td colspan="3">&nbsp;</td>
				</tr>
				<s:set name="no" value="1" />
				<s:iterator value="transactionsList" status="rowIndex">
					<s:if test="user.id == value.user.id">
						<tr>
							<td colspan="3">
								<table width="100%" cellpadding="0" cellspacing="0" align="center">
								<s:if test="#no == 1">
									<tr>
										<td width="10%" align="center"><b>#</b></td>
										<td width="20%" align="center"><b>Item</b></td>
										<td width="25%" align="center"><b>Title</b></td>
										<td width="25%" align="center"><b>Date</b></td>
										<td width="20%" align="center"><b>Amount</b></td>
									</tr>
								</s:if>
									<tr>
										<td width="10%" align="center"><s:property value="#no" /></td>
										<td width="20%" align="center"><s:property value="id.itemId" /></td>
										<td width="25%" align="center"><s:property value="id.title" /></td>
										<td width="25%" align="center"><s:property value="date" /></td>
										<td width="20%" align="center"><s:property value="amount" /></td>
									</tr>
								</table>
							</td>
						</tr>
						<s:if test="#no == 1"><s:set name="no" value="#no+1" /></s:if>
					</s:if>
				</s:iterator>
				<tr>
					<td colspan="3">&nbsp;</td>
				</tr>
			</s:iterator>
			</table>
		</td>
	</tr>
</table>
